var __extends =
    (this && this.__extends) ||
    (function () {
      var e = function (t, i) {
        return (e =
          Object.setPrototypeOf ||
          ({ __proto__: [] } instanceof Array &&
            function (e, t) {
              e.__proto__ = t;
            }) ||
          function (e, t) {
            for (var i in t)
              Object.prototype.hasOwnProperty.call(t, i) && (e[i] = t[i]);
          })(t, i);
      };
      return function (t, i) {
        function r() {
          this.constructor = t;
        }
        if ("function" != typeof i && null !== i)
          throw new TypeError(
            "Class extends value " + String(i) + " is not a constructor or null"
          );
        e(t, i),
          (t.prototype =
            null === i
              ? Object.create(i)
              : ((r.prototype = i.prototype), new r()));
      };
    })(),
  AXEnjoyHistoryView = (function (e) {
    function t(t) {
      var i = e.call(this) || this;
      return (
        (i.caiquanZhuanQianListFn = {
          caller: i,
          code: 2109,
          method: function (e) {
            if (i.currentPage >= 1) {
              if (0 == e.list.length) return void i.currentPage--;
              for (s = 0; s < e.list.length; s++) {
                var t = e.list[s];
                i.enjoyDataArr.push(t), (i.dataSource = []);
              }
            } else (i.enjoyDataArr = e.list), (i.dataSource = []);
            i.isloading = !1;
            for (var r, s = 0; s < i.enjoyDataArr.length; s++)
              (r = {
                recordID: { text: i.enjoyDataArr[s].name },
                recordDescr: { text: "赢得金币：" + i.enjoyDataArr[s].money },
              }),
                i.dataSource.push(r);
            i.list_betrecord.array = i.dataSource;
          },
        }),
        (i.caiquanYingJiaListFn = {
          caller: i,
          code: 2108,
          method: function (e) {
            if (i.currentPage >= 1) {
              if (0 == e.list.length) return void i.currentPage--;
              for (s = 0; s < e.list.length; s++) {
                var t = e.list[s];
                i.enjoyDataArr.push(t), (i.dataSource = []);
              }
            } else (i.enjoyDataArr = e.list), (i.dataSource = []);
            i.isloading = !1;
            for (var r, s = 0; s < i.enjoyDataArr.length; s++)
              (r = {
                recordID: { text: i.enjoyDataArr[s].name },
                recordDescr: {
                  text:
                    "赢得次数：" +
                    i.caiquan_winorlose_timeFn(i.enjoyDataArr[s].wintime),
                },
              }),
                i.dataSource.push(r);
            i.list_betrecord.array = i.dataSource;
          },
        }),
        (i.caiquanYingZhanListFn = {
          caller: i,
          code: 2106,
          method: function (e) {
            for (var t, r = e.list, s = [], o = 0; o < r.length; o++)
              (t = {
                historyID: { text: r[o].id },
                historyNum: {
                  text:
                    r[o].name +
                    " 出 " +
                    r[o].bet +
                    i.dealCaiQuanResultFn(r[o].type),
                },
                historyResult: { text: i.dealCaiQuan_endState(r[o].state) },
              }),
                s.push(t);
            i.list_historyItem.array = s;
          },
        }),
        (i.caiquantiaozhanListFn = {
          caller: i,
          code: 2105,
          method: function (e) {
            if (i.currentPage >= 1) {
              if (0 == e.list.length) return void i.currentPage--;
              for (s = 0; s < e.list.length; s++) {
                var t = e.list[s];
                i.enjoyDataArr.push(t), (i.dataSource = []);
              }
            } else (i.enjoyDataArr = e.list), (i.dataSource = []);
            i.isloading = !1;
            for (var r, s = 0; s < i.enjoyDataArr.length; s++)
              (r = {
                historyID: { text: i.enjoyDataArr[s].id },
                historyNum: {
                  text:
                    i.enjoyDataArr[s].name +
                    " 出 " +
                    i.enjoyDataArr[s].bet +
                    i.dealCaiQuanResultFn(i.enjoyDataArr[s].type),
                },
                historyResult: {
                  text: i.dealCaiQuan_tiaoZhan(i.enjoyDataArr[s].state),
                },
              }),
                i.dataSource.push(r);
            (i.list_historyItem.array = i.dataSource),
              (i.list_historyItem.vScrollBarSkin = "");
          },
        }),
        (i.sanguoyazhiyuanListFn = {
          caller: i,
          code: 4435,
          method: function (e) {
            if (i.currentPage >= 1) {
              if (0 == e.list.length) return void i.currentPage--;
              for (s = 0; s < e.list.length; s++) {
                var t = e.list[s];
                i.enjoyDataArr.push(t), (i.dataSource = []);
              }
            } else (i.enjoyDataArr = e.list), (i.dataSource = []);
            i.isloading = !1;
            for (var r, s = 0; s < i.enjoyDataArr.length; s++)
              (r = {
                recordID: { text: "第 " + i.enjoyDataArr[s].rndNum + " 期" },
                recordDescr: {
                  text:
                    "您为 " +
                    i.dealSanGuoResultFn(i.enjoyDataArr[s].side) +
                    "国 支援 金:" +
                    i.enjoyDataArr[s].gold +
                    " 银:" +
                    i.enjoyDataArr[s].sliver,
                },
              }),
                i.dataSource.push(r);
            (i.list_betrecord.array = i.dataSource),
              (i.list_betrecord.vScrollBarSkin = "");
          },
        }),
        (i.sanguoyaRecordListFn = {
          caller: i,
          code: 4434,
          method: function (e) {
            if (i.currentPage >= 1) {
              if (0 == e.list.length) return void i.currentPage--;
              for (s = 0; s < e.list.length; s++) {
                var t = e.list[s];
                i.enjoyDataArr.push(t), (i.dataSource = []);
              }
            } else (i.enjoyDataArr = e.list), (i.dataSource = []);
            i.isloading = !1;
            for (var r, s = 0; s < i.enjoyDataArr.length; s++)
              (r = {
                historyID: { text: "第 " + i.enjoyDataArr[s].rndNum + " 期" },
                historyNum: {
                  text:
                    "金:" +
                    i.enjoyDataArr[s].gold +
                    " 银:" +
                    i.enjoyDataArr[s].sliver,
                },
                historyResult: {
                  text: i.dealSanGuoResultFn(i.enjoyDataArr[s].result),
                },
              }),
                i.dataSource.push(r);
            i.list_historyItem.array = i.dataSource;
          },
        }),
        (i.rewardRecordListFn = {
          caller: i,
          code: 1340,
          method: function (e) {
            var t = [];
            if (i.currentPage >= 1) {
              if (0 == e.list.length) return void i.currentPage--;
              for (o = 0; o < e.list.length; o++) {
                var r = e.list[o];
                i.enjoyDataArr.push(r), (t = []);
              }
            } else (i.enjoyDataArr = e.list), (t = []);
            i.isloading = !1;
            for (var s, o = 0; o < i.enjoyDataArr.length; o++)
              (s = {
                historyID: { text: i.enjoyDataArr[o].title },
                historyNum: { text: i.enjoyDataArr[o].userid },
                historyResult: { text: i.enjoyDataArr[o].name },
              }),
                t.push(s);
            i.list_historyItem.array = t;
          },
        }),
        (i.bettingRecordListFn = {
          caller: i,
          code: 1339,
          method: function (e) {
            if (i.currentPage >= 1) {
              if (0 == e.list.length) return void i.currentPage--;
              for (s = 0; s < e.list.length; s++) {
                var t = e.list[s];
                i.enjoyDataArr.push(t), (i.dataSource = []);
              }
            } else (i.enjoyDataArr = e.list), (i.dataSource = []);
            i.isloading = !1;
            for (var r, s = 0; s < i.enjoyDataArr.length; s++)
              (r = {
                recordID: { text: "第 " + i.enjoyDataArr[s].game_id + " 期" },
                recordDescr: { text: i.enjoyDataArr[s].descr },
              }),
                i.dataSource.push(r);
            i.list_betrecord.array = i.dataSource;
          },
        }),
        (i.historyItemListFn = {
          caller: i,
          code: 1338,
          method: function (e) {
            if (i.currentPage >= 1) {
              if (0 == e.list.length) return void i.currentPage--;
              for (s = 0; s < e.list.length; s++) {
                var t = e.list[s];
                i.enjoyDataArr.push(t), (i.dataSource = []);
              }
            } else (i.enjoyDataArr = e.list), (i.dataSource = []);
            (i.isloading = !1), Utils.dealTransAndLvl;
            for (var r, s = 0; s < i.enjoyDataArr.length; s++)
              (r = {
                historyID: { text: "第 " + i.enjoyDataArr[s].id + " 期" },
                historyNum: {
                  text:
                    i.dealPerNumToBaGua(i.enjoyDataArr[s].prenum1) +
                    " , " +
                    i.dealPerNumToBaGua(i.enjoyDataArr[s].prenum2) +
                    " , " +
                    i.dealPerNumToBaGua(i.enjoyDataArr[s].prenum3),
                },
                historyResult: {
                  text: Utils.dealCompentResult(
                    i.enjoyDataArr[s].prenum1,
                    i.enjoyDataArr[s].prenum2,
                    i.enjoyDataArr[s].prenum3
                  ),
                },
              }),
                i.dataSource.push(r);
            i.list_historyItem.array = i.dataSource;
          },
        }),
        i.btn_historyback.on(Laya.Event.CLICK, i, i.onHistoryBackFn),
        (i.list_historyItem.vScrollBarSkin = ""),
        (i.list_historyItem.scrollBar.changeHandler = new Laya.Handler(
          i,
          i.onLoadMoreHistoryData
        )),
        (i.list_betrecord.vScrollBarSkin = ""),
        (i.list_betrecord.renderHandler = new Laya.Handler(i, i.onListRender)),
        (i.list_betrecord.scrollBar.changeHandler = new Laya.Handler(
          i,
          i.onLoadMoreRecordData
        )),
        (i.type = t),
        WebSocketService.addListener(i.historyItemListFn),
        WebSocketService.addListener(i.bettingRecordListFn),
        WebSocketService.addListener(i.rewardRecordListFn),
        WebSocketService.addListener(i.sanguoyaRecordListFn),
        WebSocketService.addListener(i.sanguoyazhiyuanListFn),
        WebSocketService.addListener(i.caiquantiaozhanListFn),
        WebSocketService.addListener(i.caiquanYingZhanListFn),
        WebSocketService.addListener(i.caiquanYingJiaListFn),
        WebSocketService.addListener(i.caiquanZhuanQianListFn),
        i
      );
    }
    return (
      __extends(t, e),
      (t.openView = function (e) {
        null == this.enjoyHisVC && (this.enjoyHisVC = new t(e)),
          (this.enjoyHisVC.type = e),
          "1" == e
            ? ((this.enjoyHisVC.lbl_mainTitle.text = "期数"),
              (this.enjoyHisVC.lbl_hisNumber.text = "开奖号码"),
              (this.enjoyHisVC.lbl_hisresult.text = "开奖"),
              (this.enjoyHisVC.lbl_hisTitle.text = "历史记录"),
              (this.enjoyHisVC.list_historyItem.visible = !0),
              (this.enjoyHisVC.lbl_hisNumber.visible = !0),
              (this.enjoyHisVC.lbl_hisresult.visible = !0),
              (this.enjoyHisVC.list_betrecord.visible = !1),
              (this.enjoyHisVC.lbl_betrecord.visible = !1),
              WebSocketService.send({ c: 1338, d: { pageNum: 0 } }))
            : "2" == e
            ? ((this.enjoyHisVC.lbl_hisTitle.text = "投注记录"),
              (this.enjoyHisVC.list_historyItem.visible = !1),
              (this.enjoyHisVC.lbl_hisNumber.visible = !1),
              (this.enjoyHisVC.lbl_hisresult.visible = !1),
              (this.enjoyHisVC.list_betrecord.visible = !0),
              (this.enjoyHisVC.lbl_betrecord.visible = !0),
              WebSocketService.send({ c: 1339, d: { pageNum: 0 } }))
            : "3" == e
            ? ((this.enjoyHisVC.lbl_hisTitle.text = "奖励排行"),
              (this.enjoyHisVC.lbl_mainTitle.text = "称号"),
              (this.enjoyHisVC.lbl_hisNumber.text = "用户ID"),
              (this.enjoyHisVC.lbl_hisresult.text = "昵称"),
              (this.enjoyHisVC.list_historyItem.visible = !0),
              (this.enjoyHisVC.lbl_hisNumber.visible = !0),
              (this.enjoyHisVC.lbl_hisresult.visible = !0),
              (this.enjoyHisVC.list_betrecord.visible = !1),
              (this.enjoyHisVC.lbl_betrecord.visible = !1),
              WebSocketService.send({ c: 1340, d: { pageNum: 0 } }))
            : "4" == e
            ? ((this.enjoyHisVC.lbl_hisTitle.text = "历史记录"),
              (this.enjoyHisVC.lbl_hisNumber.text = "下注情况"),
              (this.enjoyHisVC.lbl_hisresult.text = "胜方"),
              (this.enjoyHisVC.list_historyItem.visible = !0),
              (this.enjoyHisVC.lbl_hisNumber.visible = !0),
              (this.enjoyHisVC.lbl_hisresult.visible = !0),
              (this.enjoyHisVC.list_betrecord.visible = !1),
              (this.enjoyHisVC.lbl_betrecord.visible = !1),
              WebSocketService.send({ c: 4434, d: { pageNum: 0 } }))
            : "5" == e
            ? ((this.enjoyHisVC.lbl_hisTitle.text = "支援记录"),
              (this.enjoyHisVC.lbl_hisNumber.text = "我的下注"),
              (this.enjoyHisVC.lbl_betrecord.text = "支援记录"),
              (this.enjoyHisVC.list_historyItem.visible = !1),
              (this.enjoyHisVC.lbl_hisNumber.visible = !1),
              (this.enjoyHisVC.lbl_hisresult.visible = !1),
              (this.enjoyHisVC.list_betrecord.visible = !0),
              (this.enjoyHisVC.lbl_betrecord.visible = !0),
              WebSocketService.send({ c: 4435, d: { pageNum: 0 } }))
            : "6" == e
            ? ((this.enjoyHisVC.lbl_hisTitle.text = "挑战记录"),
              (this.enjoyHisVC.list_betrecord.visible = !1),
              (this.enjoyHisVC.lbl_betrecord.visible = !1),
              (this.enjoyHisVC.list_historyItem.visible = !0),
              (this.enjoyHisVC.lbl_mainTitle.text = "期数"),
              (this.enjoyHisVC.lbl_hisNumber.text = "对阵"),
              (this.enjoyHisVC.lbl_hisresult.text = "胜利结果"),
              WebSocketService.send({ c: 2105, d: { pageNum: 0 } }))
            : "7" == e
            ? ((this.enjoyHisVC.lbl_hisTitle.text = "迎战记录"),
              (this.enjoyHisVC.list_betrecord.visible = !1),
              (this.enjoyHisVC.lbl_betrecord.visible = !1),
              (this.enjoyHisVC.list_historyItem.visible = !0),
              (this.enjoyHisVC.lbl_mainTitle.text = "期数"),
              (this.enjoyHisVC.lbl_hisNumber.text = "对阵"),
              (this.enjoyHisVC.lbl_hisresult.text = "胜利结果"),
              WebSocketService.send({ c: 2106, d: { pageNum: 0 } }))
            : "8" == e
            ? ((this.enjoyHisVC.lbl_mainTitle.text = "用户昵称"),
              (this.enjoyHisVC.lbl_betrecord.text = "赢得金币"),
              (this.enjoyHisVC.list_historyItem.visible = !1),
              (this.enjoyHisVC.lbl_hisNumber.visible = !1),
              (this.enjoyHisVC.lbl_hisresult.visible = !1),
              (this.enjoyHisVC.list_betrecord.visible = !0),
              (this.enjoyHisVC.lbl_betrecord.visible = !0),
              WebSocketService.send({ c: 2108, d: { pageNum: 0 } }))
            : "9" == e &&
              ((this.enjoyHisVC.lbl_mainTitle.text = "用户昵称"),
              (this.enjoyHisVC.lbl_hisNumber.text = "赢得金币"),
              (this.enjoyHisVC.list_historyItem.visible = !1),
              (this.enjoyHisVC.lbl_hisNumber.visible = !1),
              (this.enjoyHisVC.lbl_hisresult.visible = !1),
              (this.enjoyHisVC.list_betrecord.visible = !0),
              (this.enjoyHisVC.lbl_betrecord.visible = !0),
              WebSocketService.send({ c: 2109, d: { pageNum: 0 } })),
          (this.enjoyHisVC.currentPage = 0);
        var i = new Date();
        return (this.enjoyHisVC.spaceTime = i.getTime()), this.enjoyHisVC;
      }),
      (t.prototype.onLoadMoreRecordData = function (e) {
        var t = e / this.list_betrecord.scrollBar.max,
          i = new Date(),
          r = !1;
        if (
          (i.getTime() - this.spaceTime >= 3e3 && (r = !0),
          1 == t && 0 == this.isloading && r)
        )
          return (
            (this.isloading = !0),
            this.currentPage++,
            "2" == this.type
              ? WebSocketService.send({
                  c: 1339,
                  d: { pageNum: this.currentPage },
                })
              : "5" == this.type
              ? WebSocketService.send({
                  c: 4435,
                  d: { pageNum: this.currentPage },
                })
              : "8" == this.type
              ? WebSocketService.send({
                  c: 2108,
                  d: { pageNum: this.currentPage },
                })
              : "9" == this.type &&
                WebSocketService.send({
                  c: 2109,
                  d: { pageNum: this.currentPage },
                }),
            void (this.spaceTime = i.getTime())
          );
      }),
      (t.prototype.onLoadMoreHistoryData = function (e) {
        var t = e / this.list_historyItem.scrollBar.max,
          i = new Date(),
          r = !1;
        if (
          (i.getTime() - this.spaceTime >= 3e3 && (r = !0),
          1 == t && 0 == this.isloading && r)
        )
          return (
            (this.isloading = !0),
            this.currentPage++,
            "1" == this.type
              ? WebSocketService.send({
                  c: 1338,
                  d: { pageNum: this.currentPage },
                })
              : "3" == this.type
              ? WebSocketService.send({
                  c: 1340,
                  d: { pageNum: this.currentPage },
                })
              : "4" == this.type
              ? WebSocketService.send({
                  c: 4434,
                  d: { pageNum: this.currentPage },
                })
              : "6" == this.type &&
                WebSocketService.send({
                  c: 2105,
                  d: { pageNum: this.currentPage },
                }),
            void (this.spaceTime = i.getTime())
          );
      }),
      (t.prototype.onListRender = function (e, t) {
        if (!(t > this.list_betrecord.array.length)) {
          var i = e.getChildByName("recordDescr");
          -1 != i.text.indexOf("赢")
            ? (i.color = "#EEC900")
            : (i.color = "#FFFFFF");
        }
      }),
      (t.prototype.dealPerNumToBaGua = function (e) {
        var t = "";
        return (
          "1" == e
            ? (t = "乾")
            : "2" == e
            ? (t = "兑")
            : "3" == e
            ? (t = "离")
            : "4" == e
            ? (t = "震")
            : "5" == e
            ? (t = "坤")
            : "6" == e
            ? (t = "艮")
            : "7" == e
            ? (t = "坎")
            : "8" == e && (t = "巽"),
          t
        );
      }),
      (t.prototype.dealSanGuoResultFn = function (e) {
        return 1 == e ? "魏" : 2 == e ? "蜀" : 3 == e ? "吴" : "等待胜利";
      }),
      (t.prototype.dealCaiQuanResultFn = function (e) {
        var t;
        return 1 == e ? (t = "金") : 2 == e && (t = "银"), t;
      }),
      (t.prototype.dealCaiQuan_endState = function (e) {
        var t;
        return (
          0 == e
            ? (t = "等待迎战")
            : 1 == e
            ? (t = "失败")
            : 2 == e
            ? (t = "获胜")
            : 3 == e && (t = "平局"),
          t
        );
      }),
      (t.prototype.dealCaiQuan_tiaoZhan = function (e) {
        var t;
        return (
          0 == e
            ? (t = "等待迎战")
            : 1 == e
            ? (t = "获胜")
            : 2 == e
            ? (t = "失败")
            : 3 == e && (t = "平局"),
          t
        );
      }),
      (t.prototype.caiquan_winorlose_timeFn = function (e) {
        return parseInt(e) >= 0
          ? "赢 " + e + " 次"
          : "输 " + Math.abs(parseInt(e)) + " 次";
      }),
      (t.prototype.onHistoryBackFn = function () {
        this.removeSelf();
      }),
      t
    );
  })(ui.SquareController.AXEnjoyHistoryViewUI);
